/**
 * Animation.cpp
 * Coyright (c) 2009 Xiaofeng Gu. All Rights Reserved.
 * Author : Xiaofeng Gu
 *
 * Creation Data : 2009/07/27
 */

#include "stdafx.h"
#include "Animation.h"
#include "Global.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

HRESULT CAnimation::OnExecute()
{
	HRESULT hr = S_OK;
	hr = __super::OnExecute();
	if (hr != S_OK)
	{
		return hr;
	}

	CAnimationProcessCard* pAnimationProcessCard = GetBlockInfo<CAnimationProcessCard>(ANIMATIONPROCESSCARD);
	Families* pFamiles = pAnimationProcessCard->GetFamilies();
	for (Families::iterator itFa = pFamiles->begin(); itFa != pFamiles->end(); itFa ++)
	{
		/*CFamily* pFamily = *itFa;
		Frames* pFrames = pFamily->GetFrames();
		if (pFrames->size() <= 0) return E_FAIL;
		long lMinTime = pFamily->GetMinTime();
		long lMaxTime = pFamily->GetMaxTime();
		long lStart = lMinTime;
		long lEnd = lMaxTime;
		long& lCurrent = pSKInfo->GetTime();
		lCurrent = lStart;
		while (lCurrent >= lStart && lCurrent < lEnd)
		{
			CDC* pDC = CSKGlobal::GetMainView()->RefreshView();

			::glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
			CFrame* pFrame = (*pFrames)[lCurrent];
			pFrame->Render();
			::SwapBuffers(pDC->GetSafeHdc());
			lCurrent++;

			long k = 0;
			for (long l = 0; l <1000000; l ++)
			{
				k ++;
			}
		}*/
	}
	

	return S_OK;
}